Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Jan 28, 2026

Summary of changes

Changes introduced in this pull request:

  • prefetch state computation snapshots for unit tests and codecov tests
  • replace justjson with sonic-rs which is better maintained and also supports duplicate object key

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Remote state snapshot support: listing and fetching snapshots, with parallel processing and per-file warnings before RPC test setup.
  • Chores

    • CI/workflow updates: added actor-bundle env wiring, switched to quicker test mode, removed test cache steps and an extra test-runner install step.
    • Dependency update: replaced one JSON library with an alternative, affecting JSON validation internals.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

Adds remote state snapshot listing and download: new public async fetch_state_tests() lists .car.zst snapshots, spawns concurrent tasks to fetch each via list_state_snapshot_files() and get_state_snapshot_file(), logs per-file errors, and integrates this step into the test snapshot workflow; CI workflow and JSON validator type changes also included.

Changes

Cohort / File(s) Summary
State snapshot CLI & workflow
src/dev/subcommands/mod.rs
Added pub async fn fetch_state_tests() to list snapshot files, spawn concurrent tasks to fetch/process each, log per-task errors, and call it from the test snapshot flow before RPC snapshot fetching.
State snapshot utilities
src/state_manager/utils.rs
Added DO_SPACE_ROOT constant, pub async fn list_state_snapshot_files() -> anyhow::Result<Vec<String>>, and pub async fn get_state_snapshot_file(file: &str) -> anyhow::Result<PathBuf>; implements remote JSON listing and file download with local caching.
RPC JSON validation
src/rpc/json_validator.rs
Switched JSON handling from justjson::Value to sonic_rs::Value / ValueRef, updated recursive checks and duplicate-key detection logic to use new API.
CI workflows
.github/workflows/coverage.yml, .github/workflows/unit-tests.yml
Removed Nextest install step from coverage job; added FOREST_ACTOR_BUNDLE_PATH env and --actor-bundle flag, switched mise test to quick, and removed cache steps.
Cargo manifest
Cargo.toml
Removed justjson dependency and added sonic-rs dependency.

Sequence Diagram

sequenceDiagram
    participant Workflow as Test Workflow
    participant Fetch as fetch_state_tests()
    participant List as list_state_snapshot_files()
    participant Remote as DO Spaces
    participant Get as get_state_snapshot_file()
    participant Task as Async Task

    Workflow->>Fetch: invoke fetch_state_tests()
    Fetch->>List: request available snapshots
    List->>Remote: GET index JSON
    Remote-->>List: return file paths (.car.zst)
    List-->>Fetch: Vec<String> paths

    loop For each snapshot file
        Fetch->>Task: spawn async task for file
        Task->>Get: download/process file
        Get->>Remote: GET file
        Remote-->>Get: stream file data
        Get-->>Task: return cached PathBuf or error
    end

    Task-->>Fetch: success/errors per task
    Fetch->>Fetch: log warnings for individual errors
    Fetch-->>Workflow: return Result (batch complete)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

RPC

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main objective: prefetching state computation snapshots to improve codecov stability, which aligns with the core changes in the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@hanabi1224 hanabi1224 marked this pull request as ready for review January 28, 2026 18:29
@hanabi1224 hanabi1224 requested a review from a team as a code owner January 28, 2026 18:29
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team January 28, 2026 18:29
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 68.85246% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.71%. Comparing base (197805f) to head (a6aa95c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/dev/subcommands/mod.rs 0.00% 14 Missing ⚠️
src/state_manager/utils.rs 86.84% 0 Missing and 5 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/json_validator.rs 93.90% <100.00%> (+0.79%) ⬆️
src/state_manager/utils.rs 82.41% <86.84%> (+0.28%) ⬆️
src/dev/subcommands/mod.rs 25.00% <0.00%> (-6.38%) ⬇️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 197805f...a6aa95c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/state_manager/utils.rs`:
- Around line 325-349: The list_state_snapshot_files function only inspects the
first element of the "Contents" array; change the parsing logic in
list_state_snapshot_files to iterate over all elements of the Contents array
(e.g., iterate arr.iter() instead of arr.first()), extract each filename string
from each element (or its "Key" field if the array holds objects), filter those
that end_with(".car.zst"), and collect them into the Vec<String> to return; also
update the test that uses files[0] to use files.get(0) per guidelines.
🧹 Nitpick comments (2)
src/state_manager/utils.rs (2)

360-366: Use .get() or .first() instead of direct indexing.

Line 365 uses files[0] for direct indexing. While the assertion on Line 364 ensures there's more than one file, using .first().unwrap() or .get(0).unwrap() would be more consistent with coding guidelines and provide clearer intent.

♻️ Suggested improvement
-            get_state_snapshot_file(&files[0]).await.unwrap();
+            get_state_snapshot_file(files.first().unwrap()).await.unwrap();

As per coding guidelines: "Use .get() instead of indexing with [index] to access collections".


234-234: Consider adding rustdoc comments for public functions.

The new public functions get_state_snapshot_file and list_state_snapshot_files would benefit from rustdoc comments explaining their purpose, parameters, and return values.

As per coding guidelines: "Document all public functions and structs with rustdoc comments".

Also applies to: 325-325

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Jan 29, 2026
@hanabi1224 hanabi1224 removed this pull request from the merge queue due to a manual request Jan 29, 2026
@hanabi1224 hanabi1224 added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 0f47e3d Jan 29, 2026
35 of 36 checks passed
@hanabi1224 hanabi1224 deleted the hm/ci-prefetch-state-snapshots branch January 29, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants